Skip to content

Conversation

@WVerlaek
Copy link
Member

@WVerlaek WVerlaek commented Jan 9, 2026

Description

Add individual spans for each build phase (prep, pull, lint, test, build, package) as children of package spans. This enables detailed timeline visualization in tracing backends to identify which phases are slow.

Introduces PhaseAwareReporter as an optional interface to avoid breaking existing reporters.

Related Issue(s)

Continues work from #298 (CLC-2107)

How to test

  1. Run a build with OTel tracing enabled:
    docker run -d --name jaeger -p 4318:4318 -p 16686:16686 jaegertracing/all-in-one:latest
    export OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4318
    export OTEL_EXPORTER_OTLP_INSECURE=true
    leeway build :some-package

https://ui.honeycomb.io/gitpod/environments/ci/datasets/leeway/result/ae66p1rchvr/trace/3LPtEYh6jZK?fields%5B%5D=s_name&fields%5B%5D=s_serviceName&fields%5B%5D=c_leeway.package.name&fields%5B%5D=c_leeway.phase.name&span=220f13ac101e37de&zoom=220f13ac101e37de

image

Add PhaseAwareReporter optional interface to enable phase-level span
creation without breaking existing reporters. Phase spans are created
as children of package spans for detailed build timeline visualization.

Changes:
- Define PhaseAwareReporter interface with phase start/finish methods
- Implement phase span tracking in OTelReporter
- Modify executeBuildPhase to call phase-aware reporters via type assertion
- Remove phase duration attributes (now captured in nested spans)
- Add comprehensive phase span tests
- Update documentation with span hierarchy and phase attributes

Closes CLC-2107

Co-authored-by: Ona <[email protected]>
@WVerlaek WVerlaek force-pushed the wv/add-phase-spans-otel branch from 0da834e to b11b412 Compare January 13, 2026 10:06
WVerlaek and others added 6 commits January 13, 2026 10:19
Co-authored-by: Ona <[email protected]>
CompositeReporter didn't implement PhaseAwareReporter, so the type
assertion in executeBuildPhase failed silently and phase spans were
never created.

Co-authored-by: Ona <[email protected]>
Phase spans were nesting under each other because the package context
was being updated to the phase context. Keep the original package
context so all phases are direct children of the package span.

Co-authored-by: Ona <[email protected]>
Track phase contexts so GetPackageContext returns the active phase
context when a phase is running. This ensures child operations like
go test tracing create spans under the test phase span.

Co-authored-by: Ona <[email protected]>
SBOM phase was handled inline without calling PhaseAwareReporter.

Co-authored-by: Ona <[email protected]>
@WVerlaek WVerlaek marked this pull request as ready for review January 13, 2026 10:45
@WVerlaek WVerlaek merged commit 74b1482 into main Jan 13, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants